package com.springBoot.controller;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class OSSController {

    @CrossOrigin
    @RequestMapping("/oss")
    public Map<String, String> policy() {
        String endpoint = "https://oss-cn-hangzhou.aliyuncs.com";
        // 从环境变量中获取访问凭证。运行本代码示例之前，请确保已设置环境变量OSS_ACCESS_KEY_ID和OSS_ACCESS_KEY_SECRET。
        String accessKeyId = "LTAI5tF1sWexbStL7avNxAhL";
        String accessKeySecret = "s5hgTy6W9BZtETGNKX9E0NkT4ju4z3";
        String bucket = "lsz-mall";
        String host = "https://" + bucket + "." + endpoint;
        String dir = "test/";
        OSS ossClient = new OSSClientBuilder().build(endpoint,accessKeyId,accessKeySecret);

        return null;

    }
}
